import request from '@/utils/request'

// 根据设备ID查询故障列表
export function listFaultByDeviceId(deviceId) {
  return request({
    url: '/gelly/fault/list/'+deviceId,
    method: 'get',
  })
}

// 根据设备ID新增故障
export function addFaultByDeviceId(data) {
  return request({
    url: '/gelly/fault/add',
    method: 'post',
    data: data
  })
}

// 根据设备ID删除故障
export function delFaultByDeviceId(deviceId,faultId) {
  return request({
    url: '/gelly/fault/del/' + faultId,
    method: 'post',
    data: deviceId
  })
}

// 查询故障列表
export function listFault(query) {
  return request({
    url: '/gelly/fault/list',
    method: 'get',
    params: query
  })
}

// 查询故障详细
export function getFault(faultId) {
  return request({
    url: '/gelly/fault/' + faultId,
    method: 'get'
  })
}

// 新增故障
export function addFault(data) {
  return request({
    url: '/gelly/fault',
    method: 'post',
    data: data
  })
}

// 修改故障
export function updateFault(data) {
  return request({
    url: '/gelly/fault',
    method: 'put',
    data: data
  })
}

// 删除故障
export function delFault(faultId) {
  return request({
    url: '/gelly/fault/' + faultId,
    method: 'delete'
  })
}
